Question: Let $g(x)=x^{^{ \cos(x)}}$. Find $g'(x)$. Choose 1 answer: Choose 1 answer: (Choice A) A $x^{^{ \cos(x)}}\left(\dfrac{\cos(x)}{x}-\sin(x)\ln(x)\right)$ (Choice B) B $\sin(x)\cdot x^{^{ \cos(x)-1}}$ (Choice C) C $\dfrac{\cos(x)}{x}-\sin(x)\ln(x)$ (Choice D) D $x^{^{ \cos(x)}}\left(-\sin(x)+\dfrac1x\right)$
$g$ is an exponential function where the variable is both in the base and in the exponent. This kind of function is called a composite exponential function. The most common way for differentiating this kind of function is with logarithmic differentiation. In logarithmic differentiation, we take the function equation and put both sides of the equation within a $\ln(x)$ function, and then differentiate both sides. The following identity (where $u$ is any function) comes in useful when using logarithmic differentiation: $\dfrac{d}{dx}\ln(u(x))=\dfrac{u'(x)}{u(x)}$ [Why is this identity true?] Let's differentiate! $\begin{aligned} g(x)&=x^{^{ \cos(x)}} \\\\ \ln(g(x))&=\ln\left(x^{^{ \cos(x)}}\right)&&\gray{\ln()\text{ both sides}} \\\\ \ln(g(x))&=\cos(x)\ln(x)&&\gray{\text{Logarithm properties}} \\\\ \dfrac{d}{dx}\ln(g(x))&=\dfrac{d}{dx}(\cos(x)\ln(x))&&\gray{\text{Diff. both sides}} \\\\ \dfrac{g'(x)}{g(x)}&=-\sin(x)\ln(x)+\cos(x)\cdot \dfrac{1}{x} \\\\ g'(x)&=g(x)\left(\dfrac{\cos(x)}{x}-\sin(x)\ln(x)\right) \end{aligned}$ Now we can replace $g(x)$ with its formula, and we got the formula for $g'(x)$. In conclusion, $g'(x)=x^{^{ \cos(x)}}\left(\dfrac{\cos(x)}{x}-\sin(x)\ln(x)\right)$.